package sg.nus.iss.vmcs.guilisteners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import sg.nus.iss.vmcs.controllers.CoinReceiver;

/**
 * Action Listener for the Coin Input Box in the Customer Panel
 * @author Philip Chew
 */
public class CoinInputListener implements ActionListener {
	
	/** Coin Receiver */
	private CoinReceiver coinReceiver;
	
	/**
	 * Creates an instance of the CoinInputListener
	 * @param receiver
	 */
	public CoinInputListener(CoinReceiver coinReceiver) {
		this.coinReceiver = coinReceiver;
	}
	
	/**
	 * Implementation of actionPerformed
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		coinReceiver.receiveCoin(Double.parseDouble(e.getActionCommand()));
	}
}
